import logging
from logging.handlers import TimedRotatingFileHandler

formatter = '%(asctime)s %(levelname)s %(message)s'
logfile = "./log/logger_server.log"
file_handler = TimedRotatingFileHandler(logfile, "midnight", 1, 7)
file_handler.suffix = "%Y-%m-%d"
file_handler.setLevel(logging.DEBUG)
file_handler.setFormatter(logging.Formatter(formatter))
logging.getLogger("flask").addHandler(file_handler)
logging.getLogger("flask").setLevel(logging.DEBUG)
logg = logging.getLogger("flask")
loggers = {}
loggers["flask"] = {
    "critical": logg.critical,
    "error": logg.error,
    "warning": logg.warning,
    "info": logg.info,
    "debug": logg.debug,
}

logg.critical("critical message")
logg.error("error message")
logg.warning("warning message")
logg.info("info message")
logg.debug("debug message")





# logging.basicConfig(filename='logger.log', level=logging.INFO)
# # sh = logging.StreamHandler(stream=None)
# # fh = logging.FileHandler("test.txt.log", mode='a', encoding=None, delay=False)
# logging.debug("debug message")
# logging.info("info messasge")
# logging.warning("warn message")
# logging.error("error message")
# logging.critical("critical message")